package com.forum.module.blog.convert.likes;

import com.forum.framework.common.util.colletion.CollectionUtils;
import com.forum.framework.common.util.object.BeanUtils;
import com.forum.module.blog.controller.likes.vo.LikesRespVO;
import com.forum.module.blog.dal.dataobject.likes.LikesDO;
import org.mapstruct.Mapper;
import org.mapstruct.factory.Mappers;

import java.util.List;

@Mapper
public interface LikesConvert {
    LikesConvert INSTANCE = Mappers.getMapper(LikesConvert.class);

    default List<LikesRespVO> covertList(List<LikesDO> list) {
        return CollectionUtils.convertList(list, this::covert);
    }

    default LikesRespVO covert(LikesDO likesDO) {
        return BeanUtils.toBean(likesDO, LikesRespVO.class);
    }
}
